package com.jiangyg.mall.coupon.config;

import com.jiangyg.mall.core.utils.Logger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 类描述：优惠卷消息队列配置
 *
 * @author jiangyg
 * @date 2022-12-18
 */
@Slf4j
@Configuration
public class CouponRabbitConfiguration implements InitializingBean {

    // TODO 实现监听

    /**
     * 功能描述：声明优惠卷释放队列
     *
     * @return 优惠卷释放队列
     */
    @Bean
    public Queue couponReleaseQueue() {
        return new Queue("order.coupon.release.queue", true, false, false, null);
    }

    @Override
    public void afterPropertiesSet() {
        Logger.info(log, () -> "[项目启动]-初始化优惠卷服务的 RabbitMQ 配置……");
    }

}
